package com.springboot.bookmanegersystem.controller;


import com.springboot.bookmanegersystem.model.resp.Result;
import com.springboot.bookmanegersystem.model.UserInfo;
import com.springboot.bookmanegersystem.model.req.UserRequestParam;
import com.springboot.bookmanegersystem.service.UserService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpSession;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.DigestUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.nio.charset.StandardCharsets;

/**
 * Created with IntelliJ IDEA.
 * Description :
 * User: jiume
 * Date: 2025-03-24
 * Time: 9:44
 */
@RestController
@RequestMapping("/user")
public class UserInfoController {

    @Resource
    private UserService userService;

    // 用户注册
    @PostMapping(value = "/register")
    public Result userRegister(@RequestBody UserRequestParam userRequestParam) {
        return userService.userRegister(userRequestParam);
    }

    // 用户登录
    @PostMapping(value = "/login")
    public Result userLogin(@RequestBody UserRequestParam userRequestParam, HttpSession session) {
        return userService.userLogin(userRequestParam, session);
    }
}
